import axios from '@/utils/request'
const base = '/shopmovie'

export function grantCoupon(userId, data) {
  return axios({
    url: `${base}/coupons/user/` + userId,
    method: 'post',
    data
  })
}

export function saveCoupon(data) {
  return axios({
    url: `${base}/coupons/qrcode`,
    method: 'post',
    data
  })
}

export function loadCoupon(id) {
  return axios({
    url: `${base}/coupons/` + id,
    method: 'get'
  })
}

export function listCoupon(params) {
  return axios({
    url: `${base}/coupons`,
    method: 'get',
    params: params
  })
}

export function deleteCoupon(id) {
  return axios({
    url: `${base}/coupons/` + id,
    method: 'delete'
  })
}
